package com.gupao.study.factory.main;

import com.gupao.study.factory.AlipayFactory;
import com.gupao.study.factory.WeChatFactory;
import com.gupao.study.factory.WeChatPay;
import com.gupao.study.factory.interfaces.IPay;
import com.gupao.study.factory.interfaces.IPayFactory;

/**
 * 测试类
 */
public class Test {
    public static void main(String[] args) {
        //支付宝支付
        IPayFactory factory = new AlipayFactory();
        IPay pay = factory.crate();
        pay.pay();

        //微信支付
        factory = new WeChatFactory();
        pay = factory.crate();
        pay.pay();

        // 后续如果还有其他工厂和支付，只需要在新创建对于的接口实现就好了
        // 客户端在自己选择需要的工厂来创建支付
    }
}
